//    Copyright (C) 2013  <lugocreation@gmail.com>
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
package org.jpgolay.me.db;

import java.io.Serializable;

public class Db
        implements Serializable {

    public Db() {
    }

    public Db(Integer id, String name, String dbname, String login, String password, String url, String adminLogin,
            String adminPassword, String adminUrl, String date, String updateLastUserId, String updateLastTime, String notes) {
        setId(id);
        setName(name);
        setDbname(dbname);
        setLogin(login);
        setPassword(password);
        setUrl(url);
        setAdminLogin(adminLogin);
        setAdminPassword(adminPassword);
        setAdminUrl(adminUrl);
        setDate(date);
        setUpdateLastUserId(updateLastUserId);
        setUpdateLastTime(updateLastTime);
        setNotes(notes);
    }

    public Db(Db db) {
        setId(db.getId());
        setName(db.getName());
        setDbname(db.getDbname());
        setLogin(db.getLogin());
        setPassword(db.getPassword());
        setUrl(db.getUrl());
        setAdminLogin(db.getAdminLogin());
        setAdminPassword(db.getAdminPassword());
        setAdminUrl(db.getAdminUrl());
        setDate(db.getDate());
        setUpdateLastUserId(db.getUpdateLastUserId());
        setUpdateLastTime(db.getUpdateLastTime());
        setNotes(db.getNotes());
    }

    public Integer getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public String getDbname() {
        return dbname;
    }

    public String getLogin() {
        return login;
    }

    public String getPassword() {
        return password;
    }

    public String getUrl() {
        return url;
    }

    public String getAdminLogin() {
        return adminLogin;
    }

    public String getAdminPassword() {
        return adminPassword;
    }

    public String getAdminUrl() {
        return adminUrl;
    }

    public String getDate() {
        return date;
    }

    public String getUpdateLastTime() {
        return updateLastTime;
    }

    public String getUpdateLastUserId() {
        return updateLastUserId;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setDbname(String dbname) {
        this.dbname = dbname;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public void setAdminLogin(String adminLogin) {
        this.adminLogin = adminLogin;
    }

    public void setAdminPassword(String adminPassword) {
        this.adminPassword = adminPassword;
    }

    public void setAdminUrl(String adminUrl) {
        this.adminUrl = adminUrl;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public void setUpdateLastTime(String updateLastTime) {
        this.updateLastTime = updateLastTime;
    }

    public void setUpdateLastUserId(String updateLastUserId) {
        this.updateLastUserId = updateLastUserId;
    }

    public String getNotes() {
        return notes;
    }

    public void setNotes(String notes) {
        this.notes = notes;
    }

    public String toString() {
        StringBuffer str = new StringBuffer("{");
        str.append("id=" + getId() + " " + "name=" + getName() + " " + "dbname=" + getDbname() + " " + "login=" + getLogin() + " " + "password=" + getPassword() + " " + "url=" + getUrl() + " " + "adminLogin=" + getAdminLogin() + " " + "adminPassword=" + getAdminPassword() + " " + "adminUrl=" + getAdminUrl() + " " + "date=" + getDate() + " " + "updateLastUserId=" + getUpdateLastUserId() + " " + "updateLastTime=" + getUpdateLastTime() + " " + "notes=" + getNotes());
        str.append('}');
        return str.toString();
    }

    public boolean equals(Object pOther) {
        if (pOther instanceof Db) {
            Db lTest = (Db) pOther;
            boolean lEquals = true;
            if (id == null) {
                lEquals = lEquals && lTest.id == null;
            } else {
                lEquals = lEquals && id.equals(lTest.id);
            }
            if (name == null) {
                lEquals = lEquals && lTest.name == null;
            } else {
                lEquals = lEquals && name.equals(lTest.name);
            }
            if (dbname == null) {
                lEquals = lEquals && lTest.dbname == null;
            } else {
                lEquals = lEquals && dbname.equals(lTest.dbname);
            }
            if (login == null) {
                lEquals = lEquals && lTest.login == null;
            } else {
                lEquals = lEquals && login.equals(lTest.login);
            }
            if (password == null) {
                lEquals = lEquals && lTest.password == null;
            } else {
                lEquals = lEquals && password.equals(lTest.password);
            }
            if (url == null) {
                lEquals = lEquals && lTest.url == null;
            } else {
                lEquals = lEquals && url.equals(lTest.url);
            }
            if (adminLogin == null) {
                lEquals = lEquals && lTest.adminLogin == null;
            } else {
                lEquals = lEquals && adminLogin.equals(lTest.adminLogin);
            }
            if (adminPassword == null) {
                lEquals = lEquals && lTest.adminPassword == null;
            } else {
                lEquals = lEquals && adminPassword.equals(lTest.adminPassword);
            }
            if (adminUrl == null) {
                lEquals = lEquals && lTest.adminUrl == null;
            } else {
                lEquals = lEquals && adminUrl.equals(lTest.adminUrl);
            }
            if (date == null) {
                lEquals = lEquals && lTest.date == null;
            } else {
                lEquals = lEquals && date.equals(lTest.date);
            }
            if (updateLastUserId == null) {
                lEquals = lEquals && lTest.updateLastUserId == null;
            } else {
                lEquals = lEquals && updateLastUserId.equals(lTest.updateLastUserId);
            }
            if (updateLastTime == null) {
                lEquals = lEquals && lTest.updateLastTime == null;
            } else {
                lEquals = lEquals && updateLastTime.equals(lTest.updateLastTime);
            }
            if (notes == null) {
                lEquals = lEquals && lTest.notes == null;
            } else {
                lEquals = lEquals && notes.equals(lTest.notes);
            }
            return lEquals;
        } else {
            return false;
        }
    }

    public int hashCode() {
        int result = 17;
        result = 37 * result + (id == null ? 0 : id.hashCode());
        result = 37 * result + (name == null ? 0 : name.hashCode());
        result = 37 * result + (dbname == null ? 0 : dbname.hashCode());
        result = 37 * result + (login == null ? 0 : login.hashCode());
        result = 37 * result + (password == null ? 0 : password.hashCode());
        result = 37 * result + (url == null ? 0 : url.hashCode());
        result = 37 * result + (adminLogin == null ? 0 : adminLogin.hashCode());
        result = 37 * result + (adminPassword == null ? 0 : adminPassword.hashCode());
        result = 37 * result + (adminUrl == null ? 0 : adminUrl.hashCode());
        result = 37 * result + (date == null ? 0 : date.hashCode());
        result = 37 * result + (updateLastUserId == null ? 0 : updateLastUserId.hashCode());
        result = 37 * result + (updateLastTime == null ? 0 : updateLastTime.hashCode());
        result = 37 * result + (notes == null ? 0 : notes.hashCode());
        return result;
    }
    private Integer id;
    private String name;
    private String dbname;
    private String login;
    private String password;
    private String url;
    private String adminLogin;
    private String adminPassword;
    private String adminUrl;
    private String date;
    private String updateLastUserId;
    private String updateLastTime;
    private String notes;
}
